package com.mxx.common.flow;

/**
 * @author: mxx
 * @date: 2021/12/30
 * @time: 17:00
 * @Description: 描述信息
 */
public class ReflectFlowModule extends FlowModule {
    public ReflectFlowModule(FlowEvent activeEvent) {
        super(activeEvent);
    }

    @Override
    public <C extends Flow> FlowModule addMultiple(Class<C> classes) {
        flowFactoryList.add(() -> {
            try {
                return classes.getConstructor().newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        });

        return this;
    }
}
